﻿package kizzo.utils 
{
	import fl.motion.easing.Quadratic;
	
	public class CustomTweener extends PropertyTweener
	{	
		private var set_current_hook:Function;
		private var hook_scope:*;
		private var hook_args:Array;
		
		public function CustomTweener(object:*, property:String, start_value:Number, end_value:Number, steps:uint = 10, set_current_hook:Function= null, hook_scope:*=null, hook_args:Array= null) 
		{
			this.set_current_hook = set_current_hook;
			this.hook_scope = hook_scope;
			this.hook_args = hook_args;
			
			super(object, property, start_value, end_value, steps);
		}
		
		override protected function init():void
		{		

		}
		
		override protected function set_current(step:uint):void
		{			
			super.set_current(step);
			this.object[property] = Quadratic.easeInOut(step, start_value, this.total_change, this.steps);
			this.set_current_hook.apply(hook_scope, hook_args);
		}		
	}	
}